/*******************************************************************************
  * @file                   CLED.hpp
  * @Author:                MQjehovah                 mail:MQjehovah@hotmail.com
  * @version                1.0.0
  * @date                   2017.8.28
  * @brief                  
  ******************************************************************************
  * @attention
*******************************************************************************/
#ifndef  _LED_H
#define  _LED_H

/* Includes ------------------------------------------------------------------*/
#include 
template
/* Definition ----------------------------------------------------------------*/
class CLed  // CLed类
{
public:
    CLed(GPIO_TypeDef* gpio, int pins)  // 以端口和引脚构造函数
    {
        m_gpio     = gpio;
        m_pins    = pins;
    }
    inline void On()  // 点亮
    {
        if(T)
        {
            m_gpio->BSRR = m_pins;
        }
        else
        {
            m_gpio->BRR = m_pins;            
        }
    }
    inline void Off()                                                        // 关闭
    {
        if(T)
        {
            m_gpio->BRR = m_pins;
        }
        else
        {
            m_gpio->BSRR = m_pins;            
        }
    }
    inline void Switch()                                                    // 反转
    {
        m_gpio->ODR ^= m_pins;            
    }
protected:
    GPIO_TypeDef*    m_gpio;                                                    // GPIO_TypeDef指针
    int              m_pins;                                                    // 引脚
};
/* Exported Functions --------------------------------------------------------*/

#endif
/*********************************END OF FILE**********************************/
